<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>AdminLTE 2 | Starter</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="/bower_components/font-awesome/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="/bower_components/Ionicons/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="/dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. We have chosen the skin-blue for this starter
        page. However, you can choose any other skin. Make sure you
        apply the skin class to the body tag so the changes take effect. -->
  <link rel="stylesheet" href="/dist/css/skins/skin-blue.min.css">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

  <!-- Google Font -->
  <link rel="stylesheet"
        href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head>
<!--
BODY TAG OPTIONS:
=================
Apply one or more of the following classes to get the
desired effect
|---------------------------------------------------------|
| SKINS         | skin-blue                               |
|               | skin-black                              |
|               | skin-purple                             |
|               | skin-yellow                             |
|               | skin-red                                |
|               | skin-green                              |
|---------------------------------------------------------|
|LAYOUT OPTIONS | fixed                                   |
|               | layout-boxed                            |
|               | layout-top-nav                          |
|               | sidebar-collapse                        |
|               | sidebar-mini                            |
|---------------------------------------------------------|
-->
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

  <%- include('./header.ejs') %>
 
  <%- include('./menu.ejs') %>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        产品管理
        <small>Optional description</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li>
        <li class="active">Here</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content container-fluid">

        <div class="box">
            <div class="box-header with-border">
              <h3 class="box-title">
                <a href="/pro/add"><button class="btn btn-primary">添加产品</button></a>
                <a href="/pro/upload"><button class="btn btn-primary">导入产品</button></a>
              </h3>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
              <table class="table table-bordered">
                <tbody><tr>
                  <th>序号</th>
                  <th>产品名称</th>
                  <th>产品图片</th>
                  <th>产品价格
                    <a href="/pro/sort?type=price&flag=1"><button>↑</button></a>
                    <a href="/pro/sort?type=price&flag=-1"><button>↓</button></a>
                  </th>
                  <th>产品评分</th>
                  <th>产品简介</th>
                  <th>销量/库存</th>
                  <th>操作
                      <a href="/pro/sort?type=flag&flag=1"><button>↑</button></a>
                      <a href="/pro/sort?type=flag&flag=-1"><button>↓</button></a>
                  </th>
                </tr>
                <% for (var i = 0; i < data.length; i++) {%>
                <tr>
                  <td><%= i + 1 %></td>
                  <td><%= data[i].proname %></td>
                  <td>
                    <img src="<%= data[i].proimg %>" style="height: 60px;"/>
                  </td>
                  <td><%= data[i].price %></td>
                  <td><%= data[i].rating %></td>
                  <td><%= data[i].note %></td>
                  <td><%= data[i].sales %> / <%= data[i].stock %></td>
                  <td>
                    <%- data[i].flag  == 1 ? '<button class="btn disabled btn-success btn-xs">推荐</button>' : '<button class="btn disabled btn-default btn-xs">不推荐</button>' %>
                    
                    <a href="/pro/update?proid=<%= data[i].proid %>"><button class="btn btn-warning btn-xs">编辑</button></a>
                    <a href="/pro/delete?proid=<%= data[i].proid %>"><button class="btn btn-danger btn-xs">删除</button></a>
                  </td>
                </tr>
                <% } %>
              </tbody></table>
            </div>
            <!-- /.box-body -->
            <div class="box-footer clearfix">
              <ul class="pagination pagination-sm no-margin pull-right">
                <li><a href="#">«</a></li>
                <li><a href="#">1</a></li>
                <li><a href="#">2</a></li>
                <li><a href="#">3</a></li>
                <li><a href="#">»</a></li>
              </ul>
            </div>
          </div>

    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

  <%- include('./footer.ejs') %>

  <%- include('./sidebar.ejs') %>
  <!-- /.control-sidebar -->
  <!-- Add the sidebar's background. This div must be placed
  immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

<!-- REQUIRED JS SCRIPTS -->

<!-- jQuery 3 -->
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="/dist/js/adminlte.min.js"></script>

<!-- Optionally, you can add Slimscroll and FastClick plugins.
     Both of these plugins are recommended to enhance the
     user experience. -->
</body>
</html>